import 'package:flutter/material.dart';

class AppTheme {
  AppTheme._();

  // ******** 深色主题色 ********
  static const Color darkCanvasColor = Color(0xFF303030);
  static const Color darkScaffoldBackgroundColor = Color(0xFF303030);
  static const Color darkbackgroundColor = Color(0xFF222222);
  static const Color darkDividerColor = Colors.white24;

  // 文本颜色
  static const Color darkOverlineColor = Color(0xFFFFFFFF);
  static const Color darkCaptionColor = Color(0xB3FFFFFF);
  static const Color darkButtonColor = Colors.white;
  static const Color darkBodyText2Color = Color(0xFFFFFFFF);
  static const Color darkBodyText1Color = Color(0xFFFFFFFF);
  static const Color darkSubtitle2Color = Color(0xB3FFFFFF);
  static const Color darkSubtitle1Color = Color(0xFFFFFFFF);
  static const Color darkHeadline6Color = Color(0xFFFFFFFF);
  static const Color darkHeadline5Color = Color(0xFFFFFFFF);
  static const Color darkHeadline4Color = Color(0xB3FFFFFF);
  static const Color darkHeadline3Color = Color(0xB3FFFFFF);
  static const Color darkHeadline2Color = Color(0xB3FFFFFF);
  static const Color darkHeadline1Color = Color(0xB3FFFFFF);

  // ******** 浅色主题色 ********
  static const Color canvasColor = Colors.white;
  static const Color scaffoldBackgroundColor = Colors.white;
  static const Color backgroundColor = Colors.white;
  static const Color dividerColor = Colors.black12;

  // 文本颜色
  static const Color overlineColor = Color(0xDD000000);
  static const Color captionColor = Color(0x8A000000);
  static const Color buttonColor = Colors.black87;
  static const Color bodyText2Color = Color(0xDD000000);
  static const Color bodyText1Color = Color(0xDD000000);
  static const Color subtitle2Color = Color(0xDD000000);
  static const Color subtitle1Color = Color(0xDD000000);
  static const Color headline6Color = Color(0xDD000000);
  static const Color headline5Color = Color(0xDD000000);
  static const Color headline4Color = Color(0x8A000000);
  static const Color headline3Color = Color(0x8A000000);
  static const Color headline2Color = Color(0x8A000000);
  static const Color headline1Color = Color(0x8A000000);

  static const TextStyle overline = TextStyle(
    fontSize: 10.0,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle caption = TextStyle(
    fontSize: 12,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle button = TextStyle(
    fontSize: 18,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle bodyText2 = TextStyle(
    fontSize: 14,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle bodyText1 = TextStyle(
    fontSize: 16,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle subtitle2 = TextStyle(
    fontSize: 14,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle subtitle1 = TextStyle(
    fontSize: 16,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle headline6 = TextStyle(
    fontSize: 20,
    fontWeight: FontWeight.w500,
  );
  static const TextStyle headline5 = TextStyle(
    fontSize: 24,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle headline4 = TextStyle(
    fontSize: 26,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle headline3 = TextStyle(
    fontSize: 28,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle headline2 = TextStyle(
    fontSize: 30,
    fontWeight: FontWeight.w400,
  );
  static const TextStyle headline1 = TextStyle(
    fontSize: 36,
    fontWeight: FontWeight.w300,
  );

  // Material 3 文字样式定义
  static const TextStyle displayLarge = TextStyle(
    fontSize: 57.0,
    fontWeight: FontWeight.w400,
    letterSpacing: -0.25,
  );

  static const TextStyle displayMedium = TextStyle(
    fontSize: 45.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.0,
  );

  static const TextStyle displaySmall = TextStyle(
    fontSize: 36.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.0,
  );

  static const TextStyle headlineLarge = TextStyle(
    fontSize: 32.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.0,
  );

  static const TextStyle headlineMedium = TextStyle(
    fontSize: 28.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.0,
  );

  static const TextStyle headlineSmall = TextStyle(
    fontSize: 24.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.0,
  );

  static const TextStyle titleLarge = TextStyle(
    fontSize: 22.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.0,
  );

  static const TextStyle titleMedium = TextStyle(
    fontSize: 16.0,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.15,
  );

  static const TextStyle titleSmall = TextStyle(
    fontSize: 14.0,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.1,
  );

  static const TextStyle bodyLarge = TextStyle(
    fontSize: 16.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.5,
  );

  static const TextStyle bodyMedium = TextStyle(
    fontSize: 14.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.25,
  );

  static const TextStyle bodySmall = TextStyle(
    fontSize: 12.0,
    fontWeight: FontWeight.w400,
    letterSpacing: 0.4,
  );

  static const TextStyle labelLarge = TextStyle(
    fontSize: 14.0,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.1,
  );

  static const TextStyle labelMedium = TextStyle(
    fontSize: 12.0,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.5,
  );

  static const TextStyle labelSmall = TextStyle(
    fontSize: 11.0,
    fontWeight: FontWeight.w500,
    letterSpacing: 0.5,
  );
}

// 特殊颜色值
class ThemeUtil {
  static bool isDark(BuildContext context) {
    return Theme.of(context).brightness == Brightness.dark;
  }

  static Color primaryColor(BuildContext context) {
    return Theme.of(context).primaryColor;
  }

  static Color disabledColor(BuildContext context) {
    return Theme.of(context).disabledColor;
  }

  static Color getBackgroundColor(BuildContext context) {
    return Theme.of(context).scaffoldBackgroundColor;
  }

  static Color getCanvasColor(BuildContext context) {
    return Theme.of(context).canvasColor;
  }
}
